const http = require('http');

const server = http.createServer();

server.on('request', (req, res) => {
    console.log(req.headers);
    
    console.log('请求来了：', req.url);
    
    res.statusCode = 201;
    // res.setHeader('content-type', 'text/html;charset=utf-8');
    let str = "[1, 2, 3, 3, 4, 5]";

    res.end(str); 
});

server.listen(8888, () => { console.log('http://localhost:8888 服务器已启动') });